// JavaScript Document

function AutoSize(obj, ctnr) {
	if((typeof obj).toLowerCase() == "string") {
		obj = document.getElementById(obj);
	}
	if(ctnr) {
		if((typeof ctnr).toLowerCase() == "string") {
			ctnr = document.getElementById(ctnr);
		}
	} else {
		ctnr = document.documentElement;
	}
	obj.style.position = "absolute";
	obj.style.top = "0px";
	if(ctnr.style.position.toLowerCase() != "absolute") {
		ctnr.style.position = "relative";
	}
	ctnr.style.overflow = "hidden";
	var resizeHandler = function (e) {
		obj.style.left = (ctnr.offsetWidth - obj.offsetWidth) / 2 + "px";
	}
	resizeHandler(null);
	if(window.attachEvent) {
		window.attachEvent("onresize", resizeHandler, false);
	} else {		
		window.addEventListener("resize", resizeHandler, false);
	}
}